*******************************************************	
* Table 2 - DYADIC
*******************************************************

use dyads.dta, clear

* check the data - 13,292 leader-contact dyads
unique(dyad)

* number of unique leaders = 1261
unique(pid_source)

* number of unique contacts = 7081
unique(pid_target)

* unique contacts who adopted = 575
unique(pid_target) if(mf_uptake==1)

* unique contacts who adopted if there was NOT a lending tie = 504
unique(pid_target) if(mf_uptake==1 & lend==0)

* summary statistics
sum lend borrow social religious kinship getgoods givegoods giveadvice getadvice medical govisit comevisit 

* correlations
pwcorr lend borrow social religious kinship getgoods givegoods giveadvice getadvice medical govisit comevisit 

* number of other ties (besides lending and borrowing)
gen multiple_ties = social+religious+kinship+getgoods+givegoods+giveadvice+getadvice+medical+govisit+comevisit 
gen other_ties = 0 
replace other_ties = 1 if multiple_ties>0
label variable other_ties "Leader has non-financial ties to contact"

global controls1 savings_leader shg_leader caste_leader 
global controls2 savings_contact shg_contact caste_contact

* Look at the conflicts of interest of the leaders
* where leaders had lending ties to contacts (lend==1)

* Results expressed in odds ratios
eststo m1: logit mf_uptake lend other_ties mult_leaders $controls1 i.village, or robust cluster(dyad)
eststo m2: logit mf_uptake lend other_ties mult_leaders $controls1 $controls2 i.village, or robust cluster(dyad)

esttab m1 m2, eform se drop(*village $controls1 $controls2)

*Results expressed as log-odds coefficients
eststo m1: logit mf_uptake lend other_ties mult_leaders $controls1 i.village, robust cluster(dyad)
eststo m2: logit mf_uptake lend other_ties mult_leaders $controls1 $controls2 i.village, robust cluster(dyad)

sum lend other_ties mult_leaders $controls1 $controls2

esttab m1 m2, eform se drop(*village $controls1 $controls2)

*------------------------------------------
*TABLE 2 
*------------------------------------------
esttab m1 m2 using Table-2.rtf, se nostar label replace ///
	stats(ll N , fmt(2 0 2 0) label(Log-likelihood-Ratio N)) order(lend mult_leaders other_ties)  drop(*village) ///
	title(Table 2. Microfinance diffusion to the direct personal contacts of the leaders. Values shown are log-odds coefficients from logistic regression models on leader-contact dyads with village effects; the coefficients represent the odds of the binary diffusion outcome; robust standard errors are shown in parentheses and are clustered within dyads.)

	
	
	
	
